<template>
  <div>
    <el-button @click="hanldClick">任免表</el-button>
    <pageDiaog ref="pageDiaogRefs" v-if="pageDiaog"></pageDiaog>

    <el-row>
      <el-col :span="8">
        <el-table :data="tableData" style="width: 100%" @row-click="rowClick">
          <el-table-column prop="date" label="日期" width="180">
          </el-table-column>
          <el-table-column prop="name" label="姓名" width="180">
          </el-table-column>
          <el-table-column prop="address" label="地址"> </el-table-column>
        </el-table>
      </el-col>
      <el-col :span="16">
        <el-form
          :model="jbxxForm"
          ref="jbxxForm"
          label-width="120px"
          class="demo-ruleForm"
          style="width: 80%; float: left"
        >
          <el-form-item label="姓名" prop="name">
            <el-input
              v-model="jbxxForm.name"
              disabled
            ></el-input>
          </el-form-item>
          <el-form-item label="身份证号" prop="date">
            <el-input  v-model="jbxxForm.date" disabled></el-input>
          </el-form-item>
          <el-form-item label="工作单位及职务" prop="address">
            <el-input
              v-model="jbxxForm.address"
              disabled
            ></el-input>
          </el-form-item>
        </el-form>
        <div style="width: 150px; height: 180px; float: right">
          <img :src="jbxxForm.img" style="width: 95%; height: 95%" />
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import pageDiaog from "./pageDiaog.vue";
export default {
  components: { pageDiaog },
  data() {
    return {
      pageDiaog: false,
      checked: true,
      jbxxForm:{
        name:"",
        date:"",
        address:"",
        img:"",
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎1",
          address: "上海市普陀区金沙江路 1518 弄",
          img: require("./img/1.jpg"),
        },
        {
          date: "2016-05-04",
          name: "王小虎2",
          address: "上海市普陀区金沙江路 1517 弄",
          img: require("./img/2.jpg"),
        },
        {
          date: "2016-05-01",
          name: "王小虎3",
          address: "上海市普陀区金沙江路 1519 弄",
          img: require("./img/3.jpg"),
        },
        {
          date: "2016-05-03",
          name: "王小虎4",
          address: "上海市普陀区金沙江路 1516 弄",
          img: require("./img/4.jpg"),
        },
      ],
    };
  },
  methods: {
    hanldClick() {
      this.pageDiaog = true;
      this.$refs.pageDiaogRefs.init();
    },
    clear(){
      this.jbxxForm = JSON.parse(JSON.stringify({
        name:"",
        date:"",
        address:"",
        img:"",
      }))
      // this.jbxxForm.name = "";
      // this.jbxxForm.date = "";
      // this.jbxxForm.address = "";
      // this.jbxxForm.img = "";
      console.log(this.jbxxForm,"1");
    },
    rowClick(row) {
      this.clear();
      console.log(row, "row");
      this.jbxxForm = row;
      // this.jbxxForm.name = row.name; 
      // this.jbxxForm.date = row.date; 
      // this.jbxxForm.address = row.address; 
      // this.jbxxForm.img = row.img; 
      console.log(this.jbxxForm,'2');
    },
  },
};
</script>

<style>
</style>